# -*- coding: utf-8 -*-
import scrapy


class RenrenSpider(scrapy.Spider):
    name = 'renren'
    allowed_domains = ['renren.com']
    #start_urls = ['http://renren.com/']
    
    def start_requests(self):
        url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=201863047965'
        data = {
        'email':'1179150954%40qq.com',
        'icode':'',
        'origURL':'http%3A%2F%2Fwww.renren.com%2Fhome',
        'domain':'renren.com',
        'key_id':'1',
        'captcha_type':'web_login',
        'password':'453e0c4dc043225dd101f65e2aaeab3fbaf80b53adfab3014eecf6b89a5c3799',
        'rkey':'9e75e8dc3457b14c55a74627fa64fb43',
        'f':''
        }
        
        yield scrapy.FormRequest(
            url = url,
            formdata = data,
            callback = self.parse
        )

    def parse(self, response):
        print(response.status)
        #next_url = 'http://www.renren.com/top'
        #url = response.urljoin(next_url)
        #res = scrapy.Request(url=url)
        #print(res.selector.css("a.hd-name"))
